package com.cisco.vsx.email.entities;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * @author naresred
 *
 */
@Entity
@Table(name = "EMAIL_EVENT", uniqueConstraints= @UniqueConstraint(columnNames = {"NAME"}))
public class EmailEventEntity implements Serializable {

	private static final long serialVersionUID = -4890813091781987181L;
	
	@Id
	@Column(name = "ID")
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;
	
	@Column(name = "NAME", length = 60, nullable = false)
	private String name;
	
	@Column(name = "DESCRIPTION", length = 300, nullable = true)
	private String description;
	
	@Column(name = "ACTIVE", length = 1, nullable = false)
	private int active = 1;
	
	@Lob
	@Column(name = "MODEL", length=30000, nullable = true)
	private String model;

	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}	
	
	public int getActive() {
		return active;
	}
	public void setActive(int active) {
		this.active = active;
	}	
	
	public String getModel() {
		return model;
	}
	public void setModel(String model) {
		this.model = model;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + id;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		EmailEventEntity other = (EmailEventEntity) obj;
		if (id != other.id) {
			return false;
		}
		if (name == null) {
			if (other.name != null) {
				return false;
			}
		} else if (!name.equals(other.name)) {
			return false;
		}
		return true;
	}
	
	@Override
	public String toString() {
		return "EmailEventEntity [id=" + id + ", name=" + name + "]";
	}	

}
